package com.cheejee.goodscenter.module.entity;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.Length;

import com.cheejee.goodscenter.validated.InsertGroup;
import com.cheejee.goodscenter.validated.UpdateGroup;

public class GoodsCustomProperties {
	
    private Long id;

	@NotNull(message = "商品ID不能为空", groups = InsertGroup.class)
    private Long goodsId;

	@NotBlank(message = "商品自定义属性名不能为空", groups = InsertGroup.class)
	@Length(max = 200, message = "商品自定义属性名称长度不能超过200字", groups = { InsertGroup.class, UpdateGroup.class })
    private String propertiesName;

	@NotBlank(message = "商品自定义属性值不能为空", groups = InsertGroup.class)
	@Length(max = 200, message = "商品自定义属性值长度不能超过200字", groups = { InsertGroup.class, UpdateGroup.class })
    private String propertiesValue;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getGoodsId() {
        return goodsId;
    }

    public void setGoodsId(Long goodsId) {
        this.goodsId = goodsId;
    }

    public String getPropertiesName() {
        return propertiesName;
    }

    public void setPropertiesName(String propertiesName) {
        this.propertiesName = propertiesName == null ? null : propertiesName.trim();
    }

    public String getPropertiesValue() {
        return propertiesValue;
    }

    public void setPropertiesValue(String propertiesValue) {
        this.propertiesValue = propertiesValue == null ? null : propertiesValue.trim();
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", goodsId=").append(goodsId);
        sb.append(", propertiesName=").append(propertiesName);
        sb.append(", propertiesValue=").append(propertiesValue);
        sb.append("]");
        return sb.toString();
    }
}